package com.itheima.clone;

/**
 * @program: itheima-jdk8
 * @description:
 * @author: zhanghz001
 * @create: 2021-01-10 11:47
 **/
public class DeepCloneDemo {
    
    public static void main(String[] args) {
        Student1 s1 = new Student1();
        s1.setAge(11);
        s1.setName("name1");
        s1.setPerson(new Person("name_person_1", 111));
        
        System.out.println(s1);
        //
        Student1 s2 = (Student1) s1.clone();
        s2.setAge(22);
        s2.setName("name2");
        Person person = s2.getPerson();
        person.setName("name_person_2");
        person.setAge(222);
        System.out.println(s1);
        System.out.println(s2);
    }
}
